ostree-prepare-root: Allow building statically with musl
authorWilliam Manley <will@williammanley.net>
Tue, 30 Aug 2016 19:28:02 +0000 (20:28 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 30 Aug 2016 20:50:33 +0000 (20:50 +0000)
commit42dab85728385eaf538b36ed56e9db7ff3f96faa
tree598899d5862512236233320d41f3e1ec8070cc86
parentfaee3df8ae244896f531ab7ad00c8ea75f148da3
ostree-prepare-root: Allow building statically with musl

If the `--with-static-compiler=musl-gcc` configure flag is given.

ostree-prepare-root can be used as init in a system without a populated
/lib.  To support this use case we need to link statically as we will be
unable to locate libc.so at run time if it's not installed in /lib.

We support building ostree-prepare-root with a different compiler to the
rest of ostree so we can use musl rather than glibc.  This reduces the size
of the executable significantly: from ~700K -> ~30K.  We have to use
`_SCRIPTS` here to get autotools to install this as an executable but
without generating rules to make it itself which we have specified
manually.

See https://lists.gnu.org/archive/html/help-gnu-utils/2007-01/msg00007.html
for advice on using autotools in this manner.

Closes: #477
Approved by: cgwalters
Makefile-switchroot.am
configure.ac